import {defineConfig} from "vite";
import vue from "@vitejs/plugin-vue";
import {resolve} from "path";

// https://vitejs.dev/config/
export default defineConfig({
    resolve: {
        alias: {
            "@": resolve(__dirname, "src"),
        },
    },
    plugins: [vue()],
    server: {
        host: "0.0.0.0",
        port: 9090, // 前端运行端口
        proxy: {
            // 匹配所有以 '/api' 开头的请求
            "/api": {
                target: "http://127.0.0.1:8080", // 后端服务地址
                changeOrigin: true, // 允许跨域
            }
        },
    },
});
